HybridMail Technical - stamper
Updated: 09-12-2022 16:10

Stamper XML attachment

The Stamper attachment is used to add text, images, barcodes or blanking rectangles to a letter’s PDF file.

Schema

<mkzAttachment type="stamper">
	<onPreSubmit|onSubmit|onRelay>
		<stampText scan|identifier="text-specifier" pages="page-specifier" format="format-specifier" /> 
		<stampRect pages="page-specifier" format="format-specifier" /> 
		<stampImage scan|identifier="filename" pages="page-specifier" format="format-specifier" /> 
		<stampBarcode scan|identifier="code" pages="page-specifier" format="format-specifier" /> 
		<stampDataMatrix scan|identifier="code" pages="page-specifier" format="format-specifier" />
	</onPreSubmit|onSubmit|onRelay>
</mkzAttachment>

The XML can be executed during the OnPreSubmit, OnSubmit and OnRelay phases.

 

The XML supports the following elements. There can be multiple instances of any of these

<stampText>  Stamp text with configurable position, size, font, colour and rotation. The scan|identifier attribute specifies the text to stamp.

<stampRect>  Stamp a blank rectangle with configurable position, size and colour. The scan|identifier attribute is not applicable.

<stampImage>  Stamp an image (from a file) with configurable position and size. The scan|identifier attribute specifies the image filename.

<stampBarcode>  Stamp a 1-D barcode with configurable position, size and rotation. The scan|identifier attribute specifies the barcode text.

<stampDataMatrix>  Stamp a 2-D barcode with configurable position, size and rotation. The scan|identifier attribute specifies the barcode text.

All elements support the scan|identifier attributes except for <stampRect>.

The pages attribute specifies which pages will be stamped

<stampXxx pages="page-specifier">

The options are "odd", "even", "first", "last", "oddExceptFirst", "allExceptFirst", "all". The default is "odd".

pages can also be used to specify a single page number. Use positive numbers to indicate the ‘nth’ page from the start of the letter and negative numbers for the ‘nth’ page from the end of the letter. E.g.

pages="1"  stamp on the first page
pages="2"  stamp on the second page
pages="-1" stamp on the last page
pages="-3" stamp on the third last page

The format attribute is different for each element.

<stampText format="X,Y,size,[colour],[rotation],[fontname]">

Specifies the format of the stamped text,

"X,Y"      is the position in mm from the top-left corner of the page.
"size"     is the font size in points.
"colour"   is a common, recognised colour name. This is optional, the default is "black"
"rotation" is the text angle in degrees. This is optional, the default is "0".
"fontname" is font name. This is optional, the default is "Arial".
<stampRect format="X,Y,W,H,[colour]">

Specifies the format of the stamped rectangle,

"X,Y"      is the position in mm from the top-left corner of the page.
"W,H"      is the rectangle size in mm.
"colour"   is a common, recognised colour name. This is optional, the default is "white"
<stampImage format="X,Y,W,H,[rotation]">

Specifies the format of the stamped image file,

"X,Y"      is the position in mm from the top-left corner of the page.
"W,H"      is the size in mm of the rectangle into which the image will be fitted.
"rotation" is the rotation angle in degrees. Only "0", "90", "180" and "270" are supported. This is optional, the default is "0"
<stampBarcode format="X,Y,W,H,[rotation]">

Specifies the format of the stamped 1-D barcode. The length of the barcode is determined automatically.

"X,Y"      is the position in mm from the top-left corner of the page.
"W,H"      is the size in mm of the rectangle into which the barcode will be fitted. N.B. you may have to adjust this, depending on the barcode length, to make it readable.
"rotation" is the rotation angle in degrees. Only "0", "90", "180" and "270" are supported. This is optional, the default is "0"
<stampDataMatrix format="X,Y,W,H,[rotation]">

Specifies the format of the stamped 2-D barcode. The size of the barcode is determined automatically.

"X,Y"      is the position in mm from the top-left corner of the page.
"W,H"      is the size in mm of the rectangle into which the barcode will be fitted. N.B. you may have to adjust this, depending on the barcode size, to make it readable.
"rotation" is the rotation angle in degrees. Only "0", "90", "180" and "270" are supported. This is optional, the default is "0"

 

Examples

Stamp "Draft Copy" in large red text diagonally across each page.

<stampText pages="all" format="70,150,72,red,45" >Draft Copy</stampText>

Stamp a 20mm square pale grey rectangle in the bottom-right corner of the last page

<stampRect pages="-1" format="190,277,20,20,silver" />

Stamp a 2-D barcode, rotated 90 degrees, to the right of the address window on the first page

<stampDataMatrix identifier="scannedpostcode" pages="first" format="120,70,10,20,90" />

 

Notes

N.B. If specified during the <onPreSubmit> or <onSubmit> phases, the pages attribute affects the specified pages of the actual letter but not the pages of any attachments. If specified during the <onRelay> phase, this element affects the specified pages of the letter and the pages of any and all attachments.

N.B. <stampRect> stamps over the original letter text, obscuring it visibly, but not from scanning!